package com.shruijin.wy.thread.aspect;


import net.sf.jsqlparser.statement.select.Join;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class SimpleThreadAspect {

    Logger LOGGER = LoggerFactory.getLogger(this.getClass());

    @Pointcut("@annotation(com.shruijin.wy.thread.anno.SimpleThreadAnno)")
    private void pointcut1(){

    }

    @Before("pointcut1()")
    public void before(JoinPoint joinPoint){
        LOGGER.info("线程 ：{}  方法 {} 开始执行",Thread.currentThread().getName(),joinPoint.getSignature().getName());
    }

    @After("pointcut1()")
    public void after(JoinPoint joinPoint){
        LOGGER.info("线程 ：{}  方法 {} 执行完毕",Thread.currentThread().getName(),joinPoint.getSignature().getName());
    }

}
